<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page import="com.leruan.aasimp.entity.Forumuser"%>
<%@page import="com.leruan.aasimp.entity.Board"%>
<%@page import="com.leruan.aasimp.entity.Mainpost"%>
<%@ page import="java.util.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Forumuser user = (Forumuser)request.getSession().getAttribute("user");
List<Board> boards = (List<Board>)request.getAttribute("boards");
Board board = (Board)request.getAttribute("board");
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE></TITLE>
<LINK href="styles/green/ejforum.css" type=text/css rel=stylesheet>
<LINK href="styles/green/ejf_editor.css" type=text/css rel=stylesheet>
<SCRIPT src="js/common.js" type="text/javascript"></SCRIPT>
<SCRIPT src="js/member.js" type="text/javascript"></SCRIPT>
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor/kindeditor-jxhlext.js"></script>
<script type="text/javascript">
function toRegister(){
    window.location.href="toRegister";
}
</script>
<s:head/>
<s:actionerror/>
</HEAD>
<BODY onkeydown="if(event.keyCode==27) return false;" onload="loaded()">
<DIV class=wrap>
    <table>
        <tr>
            <td >
                 <div style="height:73px; width: 193px; background-image: url('images/forumlogo.jpg')"></div>
            </td>
            <td align="right" width="1000%">
                <DIV id=foruminfo>
                <%if(null==user){
                %>
                <form action="login" onSubmit="checkfield(this); return false;" method="get">
                用户名：<input type=text id="username" name="username" size=13 maxlength=30 tabindex=1/>
                密码：<input type=password id="password1" name="password1" size=8 tabindex=2 onkeypress="if((event.keyCode?event.keyCode:event.charCode)==13) $('loginform').submit();"/>
                <INPUT type=hidden id="password" name="password">&nbsp;
                <button type="submit" name=loginsubmit tabIndex=3 style="width:46px">登录</button>
                <button type="button" name="register" tabIndex=3 style="width:46px" onclick="toRegister()">注册</button></form>
                <%
                } else{
                %>
                欢迎您! <a href="userDetails?username=<%=user.getUsername() %>&userId=<%=user.getUserId() %>"><%=user.getUsername() %> <a href="logout.action">退出登录</a>
                <%
                }%>
                </DIV>
            </td>
        </tr>
    </table>
<DIV class="mainbox viewtopic">
<h1>&raquo;&nbsp;<a href="index">首页</a>&raquo;&nbsp;<a href="boardPostList?boardId=<%=board.getBoardId()%>"><%=board.getBoardName() %></a></h1>
<form id="postForm" action="addNewPost" method="post">
    <input type="hidden" id="userId" name="userId" value="<%=null==user?"":user.getUserId() %>">
<TABLE  cellSpacing=0 cellPadding=0>
  <TR>
    <TD class=postauthor  rowspan="2">
      <%=null==user?"":user.getUsername() %>
		<IMG alt="Rank: " src="images/star_5.gif" align="absmiddle" border="0"><IMG alt="Rank: " src="images/star_1.gif" align="absmiddle" border="0">
	  <DL class="profile">
	  	<DT>帖子&nbsp;<br></DT><DD>&nbsp;<br></DD>
	  	<DT>积分&nbsp;<br></DT><DD><%=null==user?"":user.getScore() %>&nbsp;<br></DD>
	  </DL>				      
	  </TD>
          <td height="300" align="left" bgcolor="#FFFFFF" style="padding-right:5px;" colspan="2"class=postdetail>
	  <DIV class=postinfo><STRONG title="ID:"><SUP>#</SUP></STRONG> 
		板块：<SELECT id="boardId" name="boardId" >
		<%
		String selected = "";
			for(Board b:boards){
			if(null==board){
			selected="";
			}else{
			  selected = b.getBoardId().equals(board.getBoardId())?" selected=\"selected\"" : "";
			}
			%>
				<option value="<%=b.getBoardId() %>" <%=selected %>><%=b.getBoardName() %></option>
			<%
			}
		 %>
		</SELECT>
		标题：<input type="text" id="postTitle" name="postTitle">
	  </DIV>
            <table height="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="100%" height="100%">
                  <textarea id="news_Id" name="content" style="padding-left:30px; width:700px;height:300px;display:none;">
                  </textarea>
                </td>
              </tr>
            </table>
          </td>
  	</TR>
  		<TR>
  		    <TD class=postfooter>
      		<DIV class=postactions><P>
		     <input type="submit" value="提交" align="right" >
      		</P>
      		</DIV>
      		</TD>
  		</TR>
</TABLE>
</form>
</DIV>
</DIV>
</BODY>
<script language="javascript" type="text/javascript">
KE.show({
  id : 'news_Id',
  imageUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm",
  flashUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm?fileType=1",
  mediaUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm?fileType=2"
});
</script> 
</HTML>
